{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\n", "

ALMA Science Archive

\n", "

Jupyter Notebooks

\n", "
\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "
\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This page contains Jupyter Notebooks to programatically access the ALMA Science Archive. The notebooks interact through Virtual Observatory standards with [ALMA's ObsCore Table Access Protocol (TAP) service](https://almascience.org/tap).\n", "\n", "Queries in [TAP](http://www.ivoa.net/documents/TAP/) are written in the SQL-like Astronomical Data Query Language ([ADQL](https://www.ivoa.net/documents/latest/ADQL.html)). ADQL queries include spatial queries as well as operations on other properties/columns of the database. This also allows the user detailed control over the returned columns.\n", "\n", "In these Jupyter notebook we will exemplify some of the most common queries. For this we will be using the astropy affiliated [PyVO client](https://pyvo.readthedocs.io), which is interoperable with other valid TAP services from other observatories." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\n", " \n", "

Table of Contents

\n", "\n", "
\n", "\n", "

0. Installation

\n", "\n", "

1. Query one source

\n", "\n", "

2. Query a catalogue of sources

\n", "\n", "

3. Query by proposal and IDs

\n", "\n", "

4. Query by science keyword

\n", "\n", "

5. Query by spatial resolution

\n", "\n", "

6. Query by covered frequency range

\n", "\n", "

7. Query by Sensitivity

\n", "\n", "

8. Query using Astroquery.ALMA

\n", "\n", "

9. Download data after query

\n", "
\n", "
\n", "\n", "\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", "

0. Installation

\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Install the required software with \n", "```bash\n", "pip3 install jupyterlab matplotlib pandas sklearn\n", "pip3 install --upgrade --pre astroquery\n", "```\n", "\n", "download the Jupyter Notebooks\n", "```bash\n", "wget https://almascience.org/alma-data/archive/archive-notebooks/alma-science-archive-notebooks.tgz -O - | tar -xz\n", "cd alma-science-archive-notebooks\n", "```\n", "and start the notebook server\n", "```bash\n", "jupyter-lab\n", "```\n", "You can modify the code in the cells and run each cell with \"Shift+Enter\". An introduction to Jupyter Notebooks [can be found here](https://jupyter-notebook.readthedocs.io/en/stable/notebook.html)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Troubleshooting\n", "\n", "Python 3.6 users, run: pip3 --upgrade astropy==4.1\n", "\n", "If you experience problems with these notebooks, please contact us through the [ALMA Helpdesk](https://help.almascience.org/)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Throughout the notebooks we will access the [ALMA ObsCore TAP service](https://almascience.org/tap/) using:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2021-11-16T10:25:44.789197Z", "iopub.status.busy": "2021-11-16T10:25:44.782867Z", "iopub.status.idle": "2021-11-16T10:25:45.683671Z", "shell.execute_reply": "2021-11-16T10:25:45.682446Z" } }, "outputs": [], "source": [ "import pyvo\n", "import pandas as pd\n", "\n", "service = pyvo.dal.TAPService(\"https://almascience.eso.org/tap\") # for the EU ALMA TAP service\n", "\n", "# service = pyvo.dal.TAPService(\"https://almascience.nao.ac.jp/tap\") # for the EA ALMA TAP service\n", "# service = pyvo.dal.TAPService(\"https://almascience.nrao.edu/tap\") # for the NA ALMA TAP service" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here some examples of the use of ADQL:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 0a: Query by coordinate and request the entire result table" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Find all ALMA observations where the footprint of the observation (stored in the VO column 's_region') intersects with our search circle where RA, Dec and the search radius are given in decimal degrees:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2021-11-16T10:25:45.693380Z", "iopub.status.busy": "2021-11-16T10:25:45.692354Z", "iopub.status.idle": "2021-11-16T10:25:46.123877Z", "shell.execute_reply": "2021-11-16T10:25:46.122715Z" } }, "outputs": [], "source": [ "query = f\"\"\"\n", " SELECT * \n", " FROM ivoa.obscore \n", " WHERE INTERSECTS(CIRCLE('ICRS',201.365063,-43.019112,0.006),s_region)=1 \n", " \"\"\"\n", "\n", "result = service.search(query)\n", "output = result.to_table().to_pandas()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The output has been directly converted into a pandas dataframe. For simplicity, we only display the first 5 rows." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2021-11-16T10:25:46.168068Z", "iopub.status.busy": "2021-11-16T10:25:46.167421Z", "iopub.status.idle": "2021-11-16T10:25:46.207335Z", "shell.execute_reply": "2021-11-16T10:25:46.207835Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
access_urlaccess_formatproposal_iddata_rightsgal_longitudegal_latitudeobs_publisher_didobs_collectionfacility_nameinstrument_nameobs_iddataproduct_typecalib_leveltarget_names_ras_decs_fovs_regions_resolutiont_mint_maxt_exptimet_resolutionem_minem_maxem_res_powerpol_stateso_ucdband_listem_resolutionauthorspub_abstractpublication_yearproposal_abstractschedblock_nameproposal_authorssensitivity_10kmscont_sensitivity_bandwidthpwvgroup_ous_uidmember_ous_uidasdm_uidobs_titletypescan_intentscience_observationspatial_scale_maxbandwidthantenna_arraysis_mosaicobs_release_datespatial_resolutionfrequency_supportfrequencyvelocity_resolutionobs_creator_namepub_titlefirst_authorqa2_passedbib_referencescience_keywordscientific_categorylastModified
0http://almascience.org/aq?member_ous_id=uid://...text/html2011.0.00008.SVPublic309.51236319.416239ADS/JAO.ALMA#2011.0.00008.SVALMAJAOALMAuid://A002/X259150/X157cube2Centaurus A201.360719-43.0205530.058089Polygon ICRS 201.401254 -43.032096 201.401354 ...1.02331555784.79568955785.043473344.261344.2610.0012210.001231251315.70776/XX/YY/phot.flux.density;phys.polarization6306.959997Azeez, Jazeel H.; Abidin, Zamri Z.; Hwang, C. ...Centaurus A, with its gas-rich elliptical host...2014Science Verification (SV) is the process by wh...CenA mosaic13.3195420.4327021.663192uid://A002/X259150/X157uid://A002/X2762c7/X132Science verification observation of Centaurus ASVTARGET WVRT9.7141151.875000e+09A004:DV07 A008:DV09 A009:DA41 A011:DV12 A015:D...T2016-06-24T14:02:07.0001.023315[229.20..231.08GHz,976.56kHz,13.2mJy/beam@10km...238.2616131183.847494observatory, ALMAALMA Observations of the Physical and Chemical...Azeez, Jazeel H. Israel, F. P. McCoy, MarkT2014A&A...562A..96I 2017AdAst2017E...6A 2017Ap...Galactic centres/nuclei, Active Galactic Nucle...Active galaxies2021-09-30T16:34:41.133
1http://almascience.org/aq?member_ous_id=uid://...text/html2011.0.00008.SVPublic309.51236319.416239ADS/JAO.ALMA#2011.0.00008.SVALMAJAOALMAuid://A002/X259150/X157cube2Centaurus A201.360719-43.0205530.058089Polygon ICRS 201.401254 -43.032096 201.401354 ...1.02331555784.79568955785.043473344.261344.2610.0012120.001221253235.70776/XX/YY/phot.flux.density;phys.polarization6306.959997Azeez, Jazeel H.; Abidin, Zamri Z.; Hwang, C. ...Centaurus A, with its gas-rich elliptical host...2014Science Verification (SV) is the process by wh...CenA mosaic13.2831330.4327021.663192uid://A002/X259150/X157uid://A002/X2762c7/X132Science verification observation of Centaurus ASVTARGET WVRT9.7141151.875000e+09A004:DV07 A008:DV09 A009:DA41 A011:DV12 A015:D...T2016-06-24T14:02:07.0001.023315[229.20..231.08GHz,976.56kHz,13.2mJy/beam@10km...238.2616131183.847494observatory, ALMAALMA Observations of the Physical and Chemical...Azeez, Jazeel H. Israel, F. P. McCoy, MarkT2014A&A...562A..96I 2017AdAst2017E...6A 2017Ap...Galactic centres/nuclei, Active Galactic Nucle...Active galaxies2021-09-30T16:34:41.133
2http://almascience.org/aq?member_ous_id=uid://...text/html2011.0.00008.SVPublic309.51236319.416239ADS/JAO.ALMA#2011.0.00008.SVALMAJAOALMAuid://A002/X259150/X157cube2Centaurus A201.360719-43.0205530.058089Polygon ICRS 201.401254 -43.032096 201.401354 ...1.02331555784.79568955785.043473344.261344.2610.0012970.001308236599.53752/XX/YY/phot.flux.density;phys.polarization6306.959997Azeez, Jazeel H.; Abidin, Zamri Z.; Hwang, C. ...Centaurus A, with its gas-rich elliptical host...2014Science Verification (SV) is the process by wh...CenA mosaic13.2385020.4327021.663192uid://A002/X259150/X157uid://A002/X2762c7/X132Science verification observation of Centaurus ASVTARGET WVRT9.7141151.875000e+09A004:DV07 A008:DV09 A009:DA41 A011:DV12 A015:D...T2016-06-24T14:02:07.0001.023315[229.20..231.08GHz,976.56kHz,13.2mJy/beam@10km...238.2616131183.847494observatory, ALMAALMA Observations of the Physical and Chemical...Azeez, Jazeel H. Israel, F. P. McCoy, MarkT2014A&A...562A..96I 2017AdAst2017E...6A 2017Ap...Galactic centres/nuclei, Active Galactic Nucle...Active galaxies2021-09-30T16:34:41.133
3http://almascience.org/aq?member_ous_id=uid://...text/html2011.0.00008.SVPublic309.51236319.416239ADS/JAO.ALMA#2011.0.00008.SVALMAJAOALMAuid://A002/X259150/X157cube2Centaurus A201.360719-43.0205530.058089Polygon ICRS 201.401254 -43.032096 201.401354 ...1.02331555784.79568955785.043473344.261344.2610.0012870.001297238519.53752/XX/YY/phot.flux.density;phys.polarization6306.959997Azeez, Jazeel H.; Abidin, Zamri Z.; Hwang, C. ...Centaurus A, with its gas-rich elliptical host...2014Science Verification (SV) is the process by wh...CenA mosaic13.3544800.4327021.663192uid://A002/X259150/X157uid://A002/X2762c7/X132Science verification observation of Centaurus ASVTARGET WVRT9.7141151.875000e+09A004:DV07 A008:DV09 A009:DA41 A011:DV12 A015:D...T2016-06-24T14:02:07.0001.023315[229.20..231.08GHz,976.56kHz,13.2mJy/beam@10km...238.2616131183.847494observatory, ALMAALMA Observations of the Physical and Chemical...Azeez, Jazeel H. Israel, F. P. McCoy, MarkT2014A&A...562A..96I 2017AdAst2017E...6A 2017Ap...Galactic centres/nuclei, Active Galactic Nucle...Active galaxies2021-09-30T16:34:41.133
4http://almascience.org/aq?member_ous_id=uid://...text/html2011.0.00010.SPublic309.51591419.417224ADS/JAO.ALMA#2011.0.00010.SALMAJAOALMAuid://A002/X327408/X217cube2CenA201.365063-43.0191120.007385Circle ICRS 201.365063 -43.019112 0.0036921.33091255950.25357355950.3059611512.0001512.0000.0013600.001366451534.98200/XX/YY/phot.flux.density;phys.polarization6614.023326McCoy, Mark; Ott, Jürgen; Meier, David S.; Mul...Centaurus A, with its gas-rich elliptical host...2017Centaurus A with its host NGC5128 is the most ...CenA 13CO, C18O, HNCO, H2CO COMPImpellizzeri, Violette; Peck, Alison; Walter, ...1.3983420.0616950.852892uid://A002/X327408/X217uid://A002/X383b50/Xc45The Physics and Chemisty of Gas in Centaurus A...STARGETT12.5997599.375000e+08A002:PM02 A004:DV04 A009:DA43 A011:DV12 A013:D...F2015-02-12T13:48:59.0001.330912[217.59..218.53GHz,488.28kHz,1.4mJy/beam@10km/...219.025328663.940713Ott, JuergenALMA Observations of the Physical and Chemical...McCoy, MarkT2017ApJ...851...76MActive Galactic Nuclei (AGN)/Quasars (QSO), Me...Active galaxies2021-09-30T16:34:41.133
\n", "
" ], "text/plain": [ " access_url access_format \\\n", "0 http://almascience.org/aq?member_ous_id=uid://... text/html \n", "1 http://almascience.org/aq?member_ous_id=uid://... text/html \n", "2 http://almascience.org/aq?member_ous_id=uid://... text/html \n", "3 http://almascience.org/aq?member_ous_id=uid://... text/html \n", "4 http://almascience.org/aq?member_ous_id=uid://... text/html \n", "\n", " proposal_id data_rights gal_longitude gal_latitude \\\n", "0 2011.0.00008.SV Public 309.512363 19.416239 \n", "1 2011.0.00008.SV Public 309.512363 19.416239 \n", "2 2011.0.00008.SV Public 309.512363 19.416239 \n", "3 2011.0.00008.SV Public 309.512363 19.416239 \n", "4 2011.0.00010.S Public 309.515914 19.417224 \n", "\n", " obs_publisher_did obs_collection facility_name instrument_name \\\n", "0 ADS/JAO.ALMA#2011.0.00008.SV ALMA JAO ALMA \n", "1 ADS/JAO.ALMA#2011.0.00008.SV ALMA JAO ALMA \n", "2 ADS/JAO.ALMA#2011.0.00008.SV ALMA JAO ALMA \n", "3 ADS/JAO.ALMA#2011.0.00008.SV ALMA JAO ALMA \n", "4 ADS/JAO.ALMA#2011.0.00010.S ALMA JAO ALMA \n", "\n", " obs_id dataproduct_type calib_level target_name \\\n", "0 uid://A002/X259150/X157 cube 2 Centaurus A \n", "1 uid://A002/X259150/X157 cube 2 Centaurus A \n", "2 uid://A002/X259150/X157 cube 2 Centaurus A \n", "3 uid://A002/X259150/X157 cube 2 Centaurus A \n", "4 uid://A002/X327408/X217 cube 2 CenA \n", "\n", " s_ra s_dec s_fov \\\n", "0 201.360719 -43.020553 0.058089 \n", "1 201.360719 -43.020553 0.058089 \n", "2 201.360719 -43.020553 0.058089 \n", "3 201.360719 -43.020553 0.058089 \n", "4 201.365063 -43.019112 0.007385 \n", "\n", " s_region s_resolution \\\n", "0 Polygon ICRS 201.401254 -43.032096 201.401354 ... 1.023315 \n", "1 Polygon ICRS 201.401254 -43.032096 201.401354 ... 1.023315 \n", "2 Polygon ICRS 201.401254 -43.032096 201.401354 ... 1.023315 \n", "3 Polygon ICRS 201.401254 -43.032096 201.401354 ... 1.023315 \n", "4 Circle ICRS 201.365063 -43.019112 0.003692 1.330912 \n", "\n", " t_min t_max t_exptime t_resolution em_min em_max \\\n", "0 55784.795689 55785.043473 344.261 344.261 0.001221 0.001231 \n", "1 55784.795689 55785.043473 344.261 344.261 0.001212 0.001221 \n", "2 55784.795689 55785.043473 344.261 344.261 0.001297 0.001308 \n", "3 55784.795689 55785.043473 344.261 344.261 0.001287 0.001297 \n", "4 55950.253573 55950.305961 1512.000 1512.000 0.001360 0.001366 \n", "\n", " em_res_power pol_states o_ucd band_list \\\n", "0 251315.70776 /XX/YY/ phot.flux.density;phys.polarization 6 \n", "1 253235.70776 /XX/YY/ phot.flux.density;phys.polarization 6 \n", "2 236599.53752 /XX/YY/ phot.flux.density;phys.polarization 6 \n", "3 238519.53752 /XX/YY/ phot.flux.density;phys.polarization 6 \n", "4 451534.98200 /XX/YY/ phot.flux.density;phys.polarization 6 \n", "\n", " em_resolution authors \\\n", "0 306.959997 Azeez, Jazeel H.; Abidin, Zamri Z.; Hwang, C. ... \n", "1 306.959997 Azeez, Jazeel H.; Abidin, Zamri Z.; Hwang, C. ... \n", "2 306.959997 Azeez, Jazeel H.; Abidin, Zamri Z.; Hwang, C. ... \n", "3 306.959997 Azeez, Jazeel H.; Abidin, Zamri Z.; Hwang, C. ... \n", "4 614.023326 McCoy, Mark; Ott, Jürgen; Meier, David S.; Mul... \n", "\n", " pub_abstract publication_year \\\n", "0 Centaurus A, with its gas-rich elliptical host... 2014 \n", "1 Centaurus A, with its gas-rich elliptical host... 2014 \n", "2 Centaurus A, with its gas-rich elliptical host... 2014 \n", "3 Centaurus A, with its gas-rich elliptical host... 2014 \n", "4 Centaurus A, with its gas-rich elliptical host... 2017 \n", "\n", " proposal_abstract \\\n", "0 Science Verification (SV) is the process by wh... \n", "1 Science Verification (SV) is the process by wh... \n", "2 Science Verification (SV) is the process by wh... \n", "3 Science Verification (SV) is the process by wh... \n", "4 Centaurus A with its host NGC5128 is the most ... \n", "\n", " schedblock_name \\\n", "0 CenA mosaic \n", "1 CenA mosaic \n", "2 CenA mosaic \n", "3 CenA mosaic \n", "4 CenA 13CO, C18O, HNCO, H2CO COMP \n", "\n", " proposal_authors sensitivity_10kms \\\n", "0 13.319542 \n", "1 13.283133 \n", "2 13.238502 \n", "3 13.354480 \n", "4 Impellizzeri, Violette; Peck, Alison; Walter, ... 1.398342 \n", "\n", " cont_sensitivity_bandwidth pwv group_ous_uid \\\n", "0 0.432702 1.663192 \n", "1 0.432702 1.663192 \n", "2 0.432702 1.663192 \n", "3 0.432702 1.663192 \n", "4 0.061695 0.852892 \n", "\n", " member_ous_uid asdm_uid \\\n", "0 uid://A002/X259150/X157 uid://A002/X2762c7/X132 \n", "1 uid://A002/X259150/X157 uid://A002/X2762c7/X132 \n", "2 uid://A002/X259150/X157 uid://A002/X2762c7/X132 \n", "3 uid://A002/X259150/X157 uid://A002/X2762c7/X132 \n", "4 uid://A002/X327408/X217 uid://A002/X383b50/Xc45 \n", "\n", " obs_title type scan_intent \\\n", "0 Science verification observation of Centaurus A SV TARGET WVR \n", "1 Science verification observation of Centaurus A SV TARGET WVR \n", "2 Science verification observation of Centaurus A SV TARGET WVR \n", "3 Science verification observation of Centaurus A SV TARGET WVR \n", "4 The Physics and Chemisty of Gas in Centaurus A... S TARGET \n", "\n", " science_observation spatial_scale_max bandwidth \\\n", "0 T 9.714115 1.875000e+09 \n", "1 T 9.714115 1.875000e+09 \n", "2 T 9.714115 1.875000e+09 \n", "3 T 9.714115 1.875000e+09 \n", "4 T 12.599759 9.375000e+08 \n", "\n", " antenna_arrays is_mosaic \\\n", "0 A004:DV07 A008:DV09 A009:DA41 A011:DV12 A015:D... T \n", "1 A004:DV07 A008:DV09 A009:DA41 A011:DV12 A015:D... T \n", "2 A004:DV07 A008:DV09 A009:DA41 A011:DV12 A015:D... T \n", "3 A004:DV07 A008:DV09 A009:DA41 A011:DV12 A015:D... T \n", "4 A002:PM02 A004:DV04 A009:DA43 A011:DV12 A013:D... F \n", "\n", " obs_release_date spatial_resolution \\\n", "0 2016-06-24T14:02:07.000 1.023315 \n", "1 2016-06-24T14:02:07.000 1.023315 \n", "2 2016-06-24T14:02:07.000 1.023315 \n", "3 2016-06-24T14:02:07.000 1.023315 \n", "4 2015-02-12T13:48:59.000 1.330912 \n", "\n", " frequency_support frequency \\\n", "0 [229.20..231.08GHz,976.56kHz,13.2mJy/beam@10km... 238.261613 \n", "1 [229.20..231.08GHz,976.56kHz,13.2mJy/beam@10km... 238.261613 \n", "2 [229.20..231.08GHz,976.56kHz,13.2mJy/beam@10km... 238.261613 \n", "3 [229.20..231.08GHz,976.56kHz,13.2mJy/beam@10km... 238.261613 \n", "4 [217.59..218.53GHz,488.28kHz,1.4mJy/beam@10km/... 219.025328 \n", "\n", " velocity_resolution obs_creator_name \\\n", "0 1183.847494 observatory, ALMA \n", "1 1183.847494 observatory, ALMA \n", "2 1183.847494 observatory, ALMA \n", "3 1183.847494 observatory, ALMA \n", "4 663.940713 Ott, Juergen \n", "\n", " pub_title \\\n", "0 ALMA Observations of the Physical and Chemical... \n", "1 ALMA Observations of the Physical and Chemical... \n", "2 ALMA Observations of the Physical and Chemical... \n", "3 ALMA Observations of the Physical and Chemical... \n", "4 ALMA Observations of the Physical and Chemical... \n", "\n", " first_author qa2_passed \\\n", "0 Azeez, Jazeel H. Israel, F. P. McCoy, Mark T \n", "1 Azeez, Jazeel H. Israel, F. P. McCoy, Mark T \n", "2 Azeez, Jazeel H. Israel, F. P. McCoy, Mark T \n", "3 Azeez, Jazeel H. Israel, F. P. McCoy, Mark T \n", "4 McCoy, Mark T \n", "\n", " bib_reference \\\n", "0 2014A&A...562A..96I 2017AdAst2017E...6A 2017Ap... \n", "1 2014A&A...562A..96I 2017AdAst2017E...6A 2017Ap... \n", "2 2014A&A...562A..96I 2017AdAst2017E...6A 2017Ap... \n", "3 2014A&A...562A..96I 2017AdAst2017E...6A 2017Ap... \n", "4 2017ApJ...851...76M \n", "\n", " science_keyword scientific_category \\\n", "0 Galactic centres/nuclei, Active Galactic Nucle... Active galaxies \n", "1 Galactic centres/nuclei, Active Galactic Nucle... Active galaxies \n", "2 Galactic centres/nuclei, Active Galactic Nucle... Active galaxies \n", "3 Galactic centres/nuclei, Active Galactic Nucle... Active galaxies \n", "4 Active Galactic Nuclei (AGN)/Quasars (QSO), Me... Active galaxies \n", "\n", " lastModified \n", "0 2021-09-30T16:34:41.133 \n", "1 2021-09-30T16:34:41.133 \n", "2 2021-09-30T16:34:41.133 \n", "3 2021-09-30T16:34:41.133 \n", "4 2021-09-30T16:34:41.133 " ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pd.set_option('display.max_columns', None)\n", "output.head(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The ALMA TAP table contains 63 columns with the following column names and units:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2021-11-16T10:25:46.217497Z", "iopub.status.busy": "2021-11-16T10:25:46.216778Z", "iopub.status.idle": "2021-11-16T10:25:46.227727Z", "shell.execute_reply": "2021-11-16T10:25:46.228351Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "access_format \n", "access_url \n", "antenna_arrays \n", "asdm_uid \n", "authors \n", "band_list \n", "bandwidth GHz\n", "bib_reference \n", "calib_level \n", "cont_sensitivity_bandwidth mJy/beam\n", "data_rights \n", "dataproduct_type \n", "em_max m\n", "em_min m\n", "em_res_power \n", "em_resolution m\n", "facility_name \n", "first_author \n", "frequency GHz\n", "frequency_support GHz\n", "gal_latitude deg\n", "gal_longitude deg\n", "group_ous_uid \n", "instrument_name \n", "is_mosaic \n", "lastModified \n", "member_ous_uid \n", "o_ucd \n", "obs_collection \n", "obs_creator_name \n", "obs_id \n", "obs_publisher_did \n", "obs_release_date \n", "obs_title \n", "pol_states \n", "proposal_abstract \n", "proposal_authors \n", "proposal_id \n", "pub_abstract \n", "pub_title \n", "publication_year \n", "pwv mm\n", "qa2_passed \n", "s_dec deg\n", "s_fov deg\n", "s_ra deg\n", "s_region deg\n", "s_resolution deg\n", "scan_intent \n", "schedblock_name \n", "science_keyword \n", "science_observation \n", "scientific_category \n", "sensitivity_10kms mJy/beam\n", "spatial_resolution arcsec\n", "spatial_scale_max arcsec\n", "t_exptime s\n", "t_max d\n", "t_min d\n", "t_resolution s\n", "target_name \n", "type \n", "velocity_resolution m / s\n" ] } ], "source": [ "print(*sorted([f\"{fieldname:28s} {result.getdesc(fieldname).unit if result.getdesc(fieldname).unit else ''}\" for fieldname in result.fieldnames]), sep='\\n')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 0b: Query by coordinate and request only few columns\n", "The query returns all ALMA observations where the footprint (s_region) intersects with the search circle specified by RA, Dec and the search radius, all in decimal degrees. Compared to the example above, the result table has now a much smaller width as only the target name, RA and Dec have been requested." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2021-11-16T10:25:46.236752Z", "iopub.status.busy": "2021-11-16T10:25:46.236015Z", "iopub.status.idle": "2021-11-16T10:25:46.381700Z", "shell.execute_reply": "2021-11-16T10:25:46.381056Z" } }, "outputs": [], "source": [ "query = f\"\"\" \n", " SELECT target_name, s_ra, s_dec \n", " FROM ivoa.obscore \n", " WHERE INTERSECTS(CIRCLE('ICRS',201.365063,-43.019112,0.006),s_region)=1\n", " \"\"\"\n", "output = service.search(query).to_table().to_pandas() " ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2021-11-16T10:25:46.392907Z", "iopub.status.busy": "2021-11-16T10:25:46.392221Z", "iopub.status.idle": "2021-11-16T10:25:46.395489Z", "shell.execute_reply": "2021-11-16T10:25:46.396169Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
target_names_ras_dec
0Centaurus A201.360719-43.020553
1Centaurus A201.360719-43.020553
2Centaurus A201.360719-43.020553
3Centaurus A201.360719-43.020553
4CenA201.365063-43.019112
\n", "
" ], "text/plain": [ " target_name s_ra s_dec\n", "0 Centaurus A 201.360719 -43.020553\n", "1 Centaurus A 201.360719 -43.020553\n", "2 Centaurus A 201.360719 -43.020553\n", "3 Centaurus A 201.360719 -43.020553\n", "4 CenA 201.365063 -43.019112" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pd.set_option('display.max_columns', None)\n", "output.head(5)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.10" } }, "nbformat": 4, "nbformat_minor": 4 }